package view.tthc;

import javax.faces.event.ActionEvent;

import javax.faces.event.ValueChangeEvent;

import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.event.DialogEvent;
import oracle.adf.view.rich.event.PopupCanceledEvent;

import org.apache.myfaces.trinidad.model.UploadedFile;

import java.io.File;

import java.io.FileInputStream;

import view.common.Utils;

import java.util.*;
import java.util.zip.*;

import java.io.FileOutputStream;

import java.io.OutputStream;

import javax.faces.component.UIComponent;

import javax.faces.component.UISelectItems;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;

import oracle.adf.model.BindingContext;
import oracle.adf.view.rich.component.rich.data.RichTable;

import oracle.adf.view.rich.component.rich.input.RichInputFile;
import oracle.adf.view.rich.component.rich.input.RichSelectOneChoice;
import oracle.adf.view.rich.component.rich.input.RichSelectOrderShuttle;
import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
import oracle.adf.view.rich.context.AdfFacesContext;

import oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding;

import oracle.binding.BindingContainer;

import oracle.jbo.JboContext;
import oracle.jbo.Row;
import oracle.jbo.RowSet;
import oracle.jbo.ViewCriteria;
import oracle.jbo.ViewCriteriaItem;
import oracle.jbo.ViewCriteriaRow;
import oracle.jbo.ViewObject;
import oracle.jbo.common.JboCompOper;
import oracle.jbo.uicli.binding.JUCtrlRangeBinding;

import org.apache.myfaces.trinidad.event.SelectionEvent;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;

public class thutucbean {
    private UploadedFile _fileVN = null;
    private UploadedFile _fileEN = null;
    private UploadedFile _fileVN2 = null;
    private UploadedFile _fileEN2 = null;
    private RichInputFile inputFileVN;
    private RichInputFile inputFileEN;
    private RichInputFile inputFileVN2;
    private RichInputFile inputFileEN2;
    private RichCommandButton buttonDownload;
    private RichPopup newPopupVN;
    private RichPopup newPopupEN;
    private RichPopup newPopupDeleteVN;
    private RichPopup newPopupDeleteEN;
    private RichPopup viewPopupVN;
    private RichPopup viewPopupEN;
    private static int operationType = 0; //0: CreateInsert, 1: Update
    private boolean unZipFile = false; //false: Keep File, true: Un ZipFile
    private boolean unZipFile2 = false; //false: Keep File, true: Un ZipFile
    private String fileDeleted;
    private UIComponent iterVN;
    private UIComponent iterEN;
    private static boolean hasFile = false;
    private boolean fileExisted = false;
    private String tieudeTimkiemVN;
    private String tieudeTimkiemEN;
    private static ArrayList<String> currentFiles = new ArrayList<String>();
    private int pageNumberVN;
    private int pageNumberEN;
    private static final int RANGE_SIZE = 15;
    private String filedinhkemVn;
    private String filedinhkemEn;
    private RichTable tblVN;
    private RichTable tblEN;
    private static String tieudeVN;
    private static String tieudeEN;
    private String resetView;

    private String danhmucSelectedValueVN;
    private SelectItem[] danhmucElementsVN = null;
    private String coquanSelectedValueVN;
    private SelectItem[] coquanElementsVN = null;
    private String linhvucSelectedValueVN;
    private SelectItem[] linhvucElementsVN = null;

    private String danhmucSelectedValueEN;
    private SelectItem[] danhmucElementsEN = null;
    private String coquanSelectedValueEN;
    private SelectItem[] coquanElementsEN = null;
    private String linhvucSelectedValueEN;
    private SelectItem[] linhvucElementsEN = null;

    private RichSelectOneChoice danhmucSelectChoiceVN;
    private RichSelectOneChoice danhmucSelectChoiceEN;
    private RichSelectOneChoice coquanSelectChoiceVN;
    private RichSelectOneChoice coquanSelectChoiceEN;
    private RichSelectOneChoice linhvucSelectChoiceVN;
    private RichSelectOneChoice linhvucSelectChoiceEN;

    private RichSelectOrderShuttle shuttleVN;
    private RichSelectOrderShuttle shuttleEN;
    private RichSelectOrderShuttle selectOrderVn;
    private RichSelectOrderShuttle selectOrderEn;
    private List<String> selectVnValues;
    private List<String> selectEnValues;

    private static List<String> validExt =
        Arrays.asList("doc", "docx", "xls", "xlsx", "pdf", "tif", "jpg",
                      "jpeg", "gif", "png", "bmp", "zip", "rar");

    public thutucbean() {
        JUCtrlRangeBinding thutucViewVN = this.getThutucViewVN();
        thutucViewVN.getIteratorBinding().getNavigatableRowIterator().scrollRange(0);

        JUCtrlRangeBinding thutucViewEN = this.getThutucViewEN();
        thutucViewEN.getIteratorBinding().getNavigatableRowIterator().scrollRange(0);
    }

    public String getResetView() {
        if (Boolean.FALSE.equals(Utils.getElExpression("#{adfFacesContext.postback}"))) {
            DCIteratorBinding thutucIteratorVN =
                Utils.getIteratorBinding("TthcThutucView_VN1Iterator");
            thutucIteratorVN.getViewObject().getViewCriteriaManager().clearViewCriterias();
            thutucIteratorVN.executeQuery();

            DCIteratorBinding thutucIteratorEN =
                Utils.getIteratorBinding("TthcThutucView_EN1Iterator");
            thutucIteratorEN.getViewObject().getViewCriteriaManager().clearViewCriterias();
            thutucIteratorEN.executeQuery();
        }
        return resetView;
    }

    public void createVN(ActionEvent actionEvent) {
        Utils.iteratorRefresh("TthcThutucView_VN1Iterator");
        Utils.execute("CreateInsertVN");
        getShuttleCoquanVn();
        Utils.showPopup(newPopupVN);
        danhmucSelectChoiceVN.setValue(null);
        linhvucSelectChoiceVN.setValue(null);
        tieudeVN = "";
    }

    public void createEN(ActionEvent actionEvent) {
        Utils.iteratorRefresh("TthcThutucView_EN1Iterator");
        Utils.execute("CreateInsertEN");
        getShuttleCoquanEn();
        Utils.showPopup(newPopupEN);
        danhmucSelectChoiceEN.setValue(null);
        linhvucSelectChoiceEN.setValue(null);
        tieudeEN = "";
    }

    public void updateVN(ActionEvent actionEvent) {
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_VN1Iterator");
        if (thutucIterator.getCurrentRow() == null) {
            String messageText = "Bạn chưa ch�?n thủ tục hành chính nào.";
            Utils.showMessage(Utils.MSG_ERROR, messageText);
        } else {
            danhmucSelectedValueVN =
                    thutucIterator.getCurrentRow().getAttribute("DanhmucId").toString();

            BindingContainer bc =
                BindingContext.getCurrent().getCurrentBindingsEntry();
            FacesCtrlHierBinding listBinding =
                (FacesCtrlHierBinding)bc.get("TthcCoquanView_VN1");
            Map<String, SelectItem> mapSelectItems = new HashMap();
            //Lấy các ID từ bảng Chuyên mục
            for (int i = 0; i < listBinding.getRowIterator().getRowCount();
                 i++) {
                SelectItem si = new SelectItem();
                si.setValue(listBinding.getAttributeFromRow(i,
                                                            "Id").toString());
                si.setLabel(listBinding.getAttributeFromRow(i,
                                                            "Tieude").toString());
                mapSelectItems.put(listBinding.getAttributeFromRow(i,
                                                                   "Id").toString(),
                                   si);
            }
            coquanSelectedValueVN =
                    thutucIterator.getCurrentRow().getAttribute("CoquanId").toString();
            String[] arrCoquan = coquanSelectedValueVN.split(",");
            ArrayList listSelectedItems = new ArrayList();
            for (int i = 0; i < arrCoquan.length; i++) {
                listSelectedItems.add(arrCoquan[i]);
            }
            UISelectItems usi = new UISelectItems();
            usi.setValue(mapSelectItems.values());
            selectOrderVn.getChildren().clear();
            selectOrderVn.setValue(listSelectedItems);
            selectOrderVn.getChildren().add(usi);

            linhvucSelectedValueVN =
                    thutucIterator.getCurrentRow().getAttribute("LinhvucId").toString();
            danhmucSelectChoiceVN.setValue(danhmucSelectedValueVN);
            linhvucSelectChoiceVN.setValue(linhvucSelectedValueVN);
            tieudeVN =
                    thutucIterator.getCurrentRow().getAttribute("Tieude").toString();
            if (thutucIterator.getCurrentRow().getAttribute("FileId") !=
                null) {
                hasFile = true;
                DCIteratorBinding fileIterator =
                    Utils.getIteratorBinding("HtFileView1Iterator");
                ViewObject vo = fileIterator.getViewObject();
                ViewCriteria vc = vo.createViewCriteria();
                ViewCriteriaRow cr = vc.createViewCriteriaRow();
                String varStr =
                    "IN (" + thutucIterator.getCurrentRow().getAttribute("FileId") +
                    ")";
                cr.setAttribute("Id", varStr);
                vc.addElement(cr);
                vo.getViewCriteriaManager().clearViewCriterias();
                vo.applyViewCriteria(vc);
                vo.executeQuery();
                String str[] =
                    thutucIterator.getCurrentRow().getAttribute("FileId").toString().split(",");
                if (str.length > 0) {
                    for (int i = 0; i < str.length; i++) {
                        currentFiles.add(str[i]);
                    }
                }
            } else {
                hasFile = false;
            }
            this.operationType = 1;
            Utils.showPopup(newPopupVN);
        }
    }

    public void updateEN(ActionEvent actionEvent) {
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_EN1Iterator");
        if (thutucIterator.getCurrentRow() == null) {
            String messageText = "Bạn chưa chọn thủ tục hành chính nào.";
            Utils.showMessage(Utils.MSG_ERROR, messageText);
        } else {
            danhmucSelectedValueEN =
                    thutucIterator.getCurrentRow().getAttribute("DanhmucId").toString();

            BindingContainer bc =
                BindingContext.getCurrent().getCurrentBindingsEntry();
            FacesCtrlHierBinding listBinding =
                (FacesCtrlHierBinding)bc.get("TthcCoquanView_EN1");
            Map<String, SelectItem> mapSelectItems = new HashMap();
            //Lấy các ID từ bảng Chuyên mục
            for (int i = 0; i < listBinding.getRowIterator().getRowCount();
                 i++) {
                SelectItem si = new SelectItem();
                si.setValue(listBinding.getAttributeFromRow(i,
                                                            "Id").toString());
                si.setLabel(listBinding.getAttributeFromRow(i,
                                                            "Tieude").toString());
                mapSelectItems.put(listBinding.getAttributeFromRow(i,
                                                                   "Id").toString(),
                                   si);
            }
            coquanSelectedValueEN =
                    thutucIterator.getCurrentRow().getAttribute("CoquanId").toString();
            String[] arrCoquan = coquanSelectedValueEN.split(",");
            ArrayList listSelectedItems = new ArrayList();
            for (int i = 0; i < arrCoquan.length; i++) {
                listSelectedItems.add(arrCoquan[i]);
            }
            UISelectItems usi = new UISelectItems();
            usi.setValue(mapSelectItems.values());
            selectOrderEn.getChildren().clear();
            selectOrderEn.setValue(listSelectedItems);
            selectOrderEn.getChildren().add(usi);

            linhvucSelectedValueEN =
                    thutucIterator.getCurrentRow().getAttribute("LinhvucId").toString();
            danhmucSelectChoiceEN.setValue(danhmucSelectedValueEN);
            //coquanSelectChoiceEN.setValue(coquanSelectedValueEN);
            linhvucSelectChoiceEN.setValue(linhvucSelectedValueEN);
            tieudeEN =
                    thutucIterator.getCurrentRow().getAttribute("Tieude").toString();
            if (thutucIterator.getCurrentRow().getAttribute("FileId") !=
                null) {
                hasFile = true;
                DCIteratorBinding fileIterator =
                    Utils.getIteratorBinding("HtFileView1Iterator");
                ViewObject vo = fileIterator.getViewObject();
                ViewCriteria vc = vo.createViewCriteria();
                ViewCriteriaRow cr = vc.createViewCriteriaRow();
                String varStr =
                    "IN (" + thutucIterator.getCurrentRow().getAttribute("FileId") +
                    ")";
                cr.setAttribute("Id", varStr);
                vc.addElement(cr);
                vo.getViewCriteriaManager().clearViewCriterias();
                vo.applyViewCriteria(vc);
                vo.executeQuery();
                String str[] =
                    thutucIterator.getCurrentRow().getAttribute("FileId").toString().split(",");
                if (str.length > 0) {
                    for (int i = 0; i < str.length; i++) {
                        currentFiles.add(str[i]);
                    }
                }
            } else {
                hasFile = false;
            }
            this.operationType = 1;
            Utils.showPopup(newPopupEN);
        }
    }

    public void commitVN(DialogEvent dialogEvent) {
        boolean validated = true;
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_VN1Iterator");
        if (_fileVN != null || _fileVN2 != null) {
            String dirRoot =
                Utils.ENUM_CAU_HINH_KHOA.FILE_ROOT.getValue("HtCauHinhView1Iterator"); //Thu muc file goc
            String dirFile =
                Utils.ENUM_CAU_HINH_KHOA.TTHC_DIR.getValue("HtCauHinhView1Iterator"); //duong dan tuong doi thu muc file
            File dirFilePath =
                new File(Utils.ENUM_CAU_HINH_KHOA.TTHC_DIR.getValue("HtCauHinhView1Iterator")); //duong dan tuong doi thu muc file
            File dir =
                new File(dirRoot, dirFile); //Duong dan tuyet doi thu muc file
            DCIteratorBinding fileIterator1 =
                Utils.getIteratorBinding("HtFileView1Iterator");
            ArrayList<String> fileList = new ArrayList<String>();

            //Xoa vat ly file cu trong truong hop cap nhat
            if (operationType == 1) {
                Object OldfileId =
                    thutucIterator.getCurrentRow().getAttribute("FileId");
                if (OldfileId != null) {
                    String[] arrFiles = OldfileId.toString().split(",");
                    for (int i = 0; i < arrFiles.length; i++) {
                        fileIterator1.setCurrentRowWithKeyValue(arrFiles[i]);
                        String duongdan =
                            fileIterator1.getCurrentRow().getAttribute("DuongDan").toString();
                        File oldPath =
                            new File(String.valueOf(Utils.ENUM_CAU_HINH_KHOA.FILE_ROOT.KHOA_HT()),
                                     duongdan);
                        Utils.fileDelete(oldPath);
                    }
                }
            }

            if (_fileVN != null) {
                if (Utils.checkFileExtension(_fileVN.getFilename(),
                                             validExt)) {
                    Object fileId = null;

                    if (this.unZipFile) {
                        try {
                            String ext =
                                _fileVN.getFilename().substring(_fileVN.getFilename().lastIndexOf("."),
                                                                _fileVN.getFilename().length());
                            if (ext.equals(".zip")) {
                                ZipInputStream zipInputStream =
                                    new ZipInputStream(_fileVN.getInputStream());
                                ZipEntry zipEntry =
                                    zipInputStream.getNextEntry();
                                while (zipEntry != null) {
                                    Utils.execute("HtFileInsert");
                                    fileId =
                                            fileIterator1.getCurrentRow().getAttribute("Id").toString();
                                    if (zipEntry.isDirectory() == false) {
                                        File fileName =
                                            fileName = new File(fileId + "_" +
                                                                zipEntry.getName());
                                        File fileEx =
                                            new File(dir, fileName.toString());
                                        File filePath =
                                            new File(dirFile, fileName.toString());
                                        if (fileEx.getParentFile().exists() ==
                                            false) {
                                            fileEx.getParentFile().mkdirs();
                                        }
                                        FileOutputStream fileExOut =
                                            new FileOutputStream(fileEx);
                                        byte[] buffer = new byte[1024];
                                        int len = 0;
                                        while ((len =
                                                zipInputStream.read(buffer)) !=
                                               -1) {
                                            fileExOut.write(buffer, 0, len);
                                        }
                                        fileIterator1.getCurrentRow().setAttribute("TenFile",
                                                                                   fileName.toString());
                                        fileIterator1.getCurrentRow().setAttribute("DuongDan",
                                                                                   filePath.toString().replace("\\",
                                                                                                               "/"));
                                        fileIterator1.getCurrentRow().setAttribute("MaUngDung",
                                                                                   Utils.ENUM_MA_UNG_DUNG.TTHC.getMaUngDung());
                                        fileList.add(fileId.toString());
                                        fileExOut.flush();
                                        fileExOut.close();
                                    }
                                    zipEntry = zipInputStream.getNextEntry();
                                }
                                zipInputStream.close();
                            } else {
                                validated = false;
                                _fileVN = null;
                                inputFileVN.resetValue();
                                inputFileVN.setValue(null);
                                inputFileVN.setChanged(false);
                                inputFileVN.setSubmittedValue(null);
                                inputFileVN.setValid(false);
                                AdfFacesContext.getCurrentInstance().addPartialTarget(inputFileVN);
                                Utils.showMessage(Utils.MSG_ERROR,
                                                  "File nén không hợp lệ! Hệ thống chỉ hỗ trợ giải nén file dạng *.zip.");
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else {
                        Utils.execute("HtFileInsert");
                        fileId =
                                fileIterator1.getCurrentRow().getAttribute("Id").toString();
                        fileList.add(fileId.toString());
                        if (Utils.fileUpload(this.getFileVN(), dir,
                                             fileId.toString())) {
                            fileIterator1.getCurrentRow().setAttribute("TenFile",
                                                                       fileId.toString() +
                                                                       "_" +
                                                                       this.getFileVN().getFilename());
                            fileIterator1.getCurrentRow().setAttribute("DuongDan",
                                                                       dirFilePath.toString().replace("\\",
                                                                                                      "/") +
                                                                       "/" +
                                                                       fileId.toString() +
                                                                       "_" +
                                                                       this.getFileVN().getFilename());
                            fileIterator1.getCurrentRow().setAttribute("MaUngDung",
                                                                       Utils.ENUM_MA_UNG_DUNG.TTHC.getMaUngDung());
                        }
                    }
                } else {
                    validated = false;
                    _fileVN = null;
                    inputFileVN.resetValue();
                    inputFileVN.setValue(null);
                    inputFileVN.setChanged(false);
                    inputFileVN.setSubmittedValue(null);
                    inputFileVN.setValid(false);
                    AdfFacesContext.getCurrentInstance().addPartialTarget(inputFileVN);
                    Utils.showMessage(Utils.MSG_ERROR,
                                      "Tập tin đính kèm chỉ chấp nhận các định dạng doc, docx, xls, xlsx, pdf, tif, jpg, jpeg, gif, png, bmp.");
                }
            }
            if (_fileVN2 != null) {
                if (Utils.checkFileExtension(_fileVN2.getFilename(),
                                             validExt)) {
                    Object fileId2 = null;
                    if (this.unZipFile2) {
                        try {
                            String ext =
                                _fileVN2.getFilename().substring(_fileVN2.getFilename().lastIndexOf("."),
                                                                 _fileVN2.getFilename().length());
                            if (ext.equals(".zip")) {
                                ZipInputStream zipInputStream =
                                    new ZipInputStream(_fileVN2.getInputStream());
                                ZipEntry zipEntry =
                                    zipInputStream.getNextEntry();
                                while (zipEntry != null) {
                                    Utils.execute("HtFileInsert");
                                    fileId2 =
                                            fileIterator1.getCurrentRow().getAttribute("Id").toString();
                                    if (zipEntry.isDirectory() == false) {
                                        File fileName =
                                            fileName = new File(fileId2 + "_" +
                                                                zipEntry.getName());
                                        File fileEx =
                                            new File(dir, fileName.toString());
                                        File filePath =
                                            new File(dirFile, fileName.toString());
                                        if (fileEx.getParentFile().exists() ==
                                            false) {
                                            fileEx.getParentFile().mkdirs();
                                        }
                                        FileOutputStream fileExOut =
                                            new FileOutputStream(fileEx);
                                        byte[] buffer = new byte[1024];
                                        int len = 0;
                                        while ((len =
                                                zipInputStream.read(buffer)) !=
                                               -1) {
                                            fileExOut.write(buffer, 0, len);
                                        }
                                        fileIterator1.getCurrentRow().setAttribute("TenFile",
                                                                                   fileName.toString());
                                        fileIterator1.getCurrentRow().setAttribute("DuongDan",
                                                                                   filePath.toString().replace("\\",
                                                                                                               "/"));
                                        fileIterator1.getCurrentRow().setAttribute("MaUngDung",
                                                                                   Utils.ENUM_MA_UNG_DUNG.TTHC.getMaUngDung());
                                        fileList.add(fileId2.toString());
                                        fileExOut.flush();
                                        fileExOut.close();
                                    }
                                    zipEntry = zipInputStream.getNextEntry();
                                }
                                zipInputStream.close();
                            } else {
                                validated = false;
                                _fileVN2 = null;
                                inputFileVN2.resetValue();
                                inputFileVN2.setValue(null);
                                inputFileVN2.setChanged(false);
                                inputFileVN2.setSubmittedValue(null);
                                inputFileVN2.setValid(false);
                                AdfFacesContext.getCurrentInstance().addPartialTarget(inputFileVN2);
                                Utils.showMessage(Utils.MSG_ERROR,
                                                  "File nén không hợp lệ! Hệ thống chỉ hỗ trợ giải nén file dạng *.zip.");
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else {
                        Utils.execute("HtFileInsert");
                        fileId2 =
                                fileIterator1.getCurrentRow().getAttribute("Id").toString();
                        fileList.add(fileId2.toString());
                        if (Utils.fileUpload(this.getFileVN2(), dir,
                                             fileId2.toString())) {
                            fileIterator1.getCurrentRow().setAttribute("TenFile",
                                                                       fileId2.toString() +
                                                                       "_" +
                                                                       this.getFileVN2().getFilename());
                            fileIterator1.getCurrentRow().setAttribute("DuongDan",
                                                                       dirFilePath.toString().replace("\\",
                                                                                                      "/") +
                                                                       "/" +
                                                                       fileId2.toString() +
                                                                       "_" +
                                                                       this.getFileVN2().getFilename());
                            fileIterator1.getCurrentRow().setAttribute("MaUngDung",
                                                                       Utils.ENUM_MA_UNG_DUNG.TTHC.getMaUngDung());
                        }
                    }
                } else {
                    validated = false;
                    _fileVN2 = null;
                    inputFileVN2.resetValue();
                    inputFileVN2.setValue(null);
                    inputFileVN2.setChanged(false);
                    inputFileVN2.setSubmittedValue(null);
                    inputFileVN2.setValid(false);
                    AdfFacesContext.getCurrentInstance().addPartialTarget(inputFileVN2);
                    Utils.showMessage(Utils.MSG_ERROR,
                                      "Tập tin đính kèm chỉ chấp nhận các định dạng doc, docx, xls, xlsx, pdf, tif, jpg, jpeg, gif, png, bmp.");

                }
            }
            if (fileList.size() > 0) {
                String fileUploadedId = "";
                for (int i = 0; i <= fileList.size() - 1; i++) {
                    fileUploadedId += fileList.get(i) + ",";
                }
                fileUploadedId =
                        fileUploadedId.substring(0, fileUploadedId.lastIndexOf(","));
                thutucIterator.getCurrentRow().setAttribute("FileId",
                                                            fileUploadedId);
            }
        } else {
            if (this.operationType == 1) {
                String fileUploadedId = "";
                if (currentFiles.size() > 0) {
                    for (int i = 0; i < currentFiles.size(); i++) {
                        fileUploadedId += currentFiles.get(i) + ",";
                    }
                    fileUploadedId =
                            fileUploadedId.substring(0, fileUploadedId.lastIndexOf(","));
                }
                thutucIterator.getCurrentRow().setAttribute("FileId",
                                                            fileUploadedId);
            }
        }
        if (tieudeVN.isEmpty() || tieudeVN == "") {
            validated = false;
            Utils.showMessage(Utils.MSG_ERROR,
                              "Tiêu đề thủ tục không được để trống.");
        }
        if (tieudeVN.equals(thutucIterator.getCurrentRow().getAttribute("Tieude")) ==
            false) {
            if (Utils.checkExisted(tieudeVN, "Tieude",
                                   "TthcThutucValidate1Iterator", "vi")) {
                validated = false;
                Utils.showMessage(Utils.MSG_ERROR,
                                  "Tiêu đề bạn vừa nhập đã tồn tại trong hệ thống.");
            }
        }
        if (validated) {
            thutucIterator.getCurrentRow().setAttribute("Tieude", tieudeVN);
            thutucIterator.getCurrentRow().setAttribute("DanhmucId",
                                                        danhmucSelectedValueVN);
            String arrCoquan = "";
            for (int i = 0; i < selectVnValues.size(); i++) {
                arrCoquan += selectVnValues.get(i) + ",";
            }
            arrCoquan = arrCoquan.substring(0, arrCoquan.lastIndexOf(","));
            thutucIterator.getCurrentRow().setAttribute("CoquanId", arrCoquan);
            thutucIterator.getCurrentRow().setAttribute("LinhvucId",
                                                        linhvucSelectedValueVN);
            if (this.operationType == 0) {
                thutucIterator.getCurrentRow().setAttribute("NgonNgu", "vi");
                thutucIterator.getCurrentRow().setAttribute("NguoiNhap",
                                                            Utils.getCurrentUser());
                thutucIterator.getCurrentRow().setAttribute("NgayNhap",
                                                            Utils.getCurrentDate());
            }
            Utils.execute("Commit");
            this.operationType = 0;
            hasFile = false;
            currentFiles.clear();
            this.unZipFile = false;
        }
    }

    public void commitEN(DialogEvent dialogEvent) {
        boolean validated = true;
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_EN1Iterator");
        if (_fileEN != null || _fileEN2 != null) {
            String dirRoot =
                Utils.ENUM_CAU_HINH_KHOA.FILE_ROOT.getValue("HtCauHinhView1Iterator"); //Thu muc file goc
            String dirFile =
                Utils.ENUM_CAU_HINH_KHOA.TTHC_DIR.getValue("HtCauHinhView1Iterator"); //duong dan tuong doi thu muc file
            File dirFilePath =
                new File(Utils.ENUM_CAU_HINH_KHOA.TTHC_DIR.getValue("HtCauHinhView1Iterator")); //duong dan tuong doi thu muc file
            File dir =
                new File(dirRoot, dirFile); //Duong dan tuyet doi thu muc file
            DCIteratorBinding fileIterator1 =
                Utils.getIteratorBinding("HtFileView1Iterator");
            ArrayList<String> fileList = new ArrayList<String>();

            //Xoa vat ly file cu trong truong hop cap nhat
            if (operationType == 1) {
                Object OldfileId =
                    thutucIterator.getCurrentRow().getAttribute("FileId");
                if (OldfileId != null) {
                    String[] arrFiles = OldfileId.toString().split(",");
                    for (int i = 0; i < arrFiles.length; i++) {
                        fileIterator1.setCurrentRowWithKeyValue(arrFiles[i]);
                        String duongdan =
                            fileIterator1.getCurrentRow().getAttribute("DuongDan").toString();
                        File oldPath =
                            new File(String.valueOf(Utils.ENUM_CAU_HINH_KHOA.FILE_ROOT.KHOA_HT()),
                                     duongdan);
                        Utils.fileDelete(oldPath);
                    }
                }
            }

            if (_fileEN != null) {
                if (Utils.checkFileExtension(_fileEN.getFilename(),
                                             validExt)) {
                    Object fileId = null;

                    if (this.unZipFile) {
                        try {
                            String ext =
                                _fileEN.getFilename().substring(_fileEN.getFilename().lastIndexOf("."),
                                                                _fileEN.getFilename().length());
                            if (ext.equals(".zip")) {
                                ZipInputStream zipInputStream =
                                    new ZipInputStream(_fileEN.getInputStream());
                                ZipEntry zipEntry =
                                    zipInputStream.getNextEntry();
                                while (zipEntry != null) {
                                    Utils.execute("HtFileInsert");
                                    fileId =
                                            fileIterator1.getCurrentRow().getAttribute("Id").toString();
                                    if (zipEntry.isDirectory() == false) {
                                        File fileName =
                                            fileName = new File(fileId + "_" +
                                                                zipEntry.getName());
                                        File fileEx =
                                            new File(dir, fileName.toString());
                                        File filePath =
                                            new File(dirFile, fileName.toString());
                                        if (fileEx.getParentFile().exists() ==
                                            false) {
                                            fileEx.getParentFile().mkdirs();
                                        }
                                        FileOutputStream fileExOut =
                                            new FileOutputStream(fileEx);
                                        byte[] buffer = new byte[1024];
                                        int len = 0;
                                        while ((len =
                                                zipInputStream.read(buffer)) !=
                                               -1) {
                                            fileExOut.write(buffer, 0, len);
                                        }
                                        fileIterator1.getCurrentRow().setAttribute("TenFile",
                                                                                   fileName.toString());
                                        fileIterator1.getCurrentRow().setAttribute("DuongDan",
                                                                                   filePath.toString().replace("\\",
                                                                                                               "/"));
                                        fileIterator1.getCurrentRow().setAttribute("MaUngDung",
                                                                                   Utils.ENUM_MA_UNG_DUNG.TTHC.getMaUngDung());
                                        fileList.add(fileId.toString());
                                        fileExOut.flush();
                                        fileExOut.close();
                                    }
                                    zipEntry = zipInputStream.getNextEntry();
                                }
                                zipInputStream.close();
                            } else {
                                validated = false;
                                _fileEN = null;
                                inputFileEN.resetValue();
                                inputFileEN.setValue(null);
                                inputFileEN.setChanged(false);
                                inputFileEN.setSubmittedValue(null);
                                inputFileEN.setValid(false);
                                AdfFacesContext.getCurrentInstance().addPartialTarget(inputFileEN);
                                Utils.showMessage(Utils.MSG_ERROR,
                                                  "File nén không hợp lệ! Hệ thống chỉ hỗ trợ giải nén file dạng *.zip.");
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else {
                        Utils.execute("HtFileInsert");
                        fileId =
                                fileIterator1.getCurrentRow().getAttribute("Id").toString();
                        fileList.add(fileId.toString());
                        if (Utils.fileUpload(this.getFileEN(), dir,
                                             fileId.toString())) {
                            fileIterator1.getCurrentRow().setAttribute("TenFile",
                                                                       fileId.toString() +
                                                                       "_" +
                                                                       this.getFileEN().getFilename());
                            fileIterator1.getCurrentRow().setAttribute("DuongDan",
                                                                       dirFilePath.toString().replace("\\",
                                                                                                      "/") +
                                                                       "/" +
                                                                       fileId.toString() +
                                                                       "_" +
                                                                       this.getFileEN().getFilename());
                            fileIterator1.getCurrentRow().setAttribute("MaUngDung",
                                                                       Utils.ENUM_MA_UNG_DUNG.TTHC.getMaUngDung());
                        }
                    }
                } else {
                    validated = false;
                    _fileEN = null;
                    inputFileEN.resetValue();
                    inputFileEN.setValue(null);
                    inputFileEN.setChanged(false);
                    inputFileEN.setSubmittedValue(null);
                    inputFileEN.setValid(false);
                    AdfFacesContext.getCurrentInstance().addPartialTarget(inputFileEN);
                    Utils.showMessage(Utils.MSG_ERROR,
                                      "Tập tin đính kèm chỉ chấp nhận các định dạng doc, docx, xls, xlsx, pdf, tif, jpg, jpeg, gif, png, bmp.");
                }
            }
            if (_fileEN2 != null) {
                if (Utils.checkFileExtension(_fileEN2.getFilename(),
                                             validExt)) {
                    Object fileId2 = null;
                    if (this.unZipFile2) {
                        try {
                            String ext =
                                _fileEN2.getFilename().substring(_fileEN2.getFilename().lastIndexOf("."),
                                                                 _fileEN2.getFilename().length());
                            if (ext.equals(".zip")) {
                                ZipInputStream zipInputStream =
                                    new ZipInputStream(_fileEN2.getInputStream());
                                ZipEntry zipEntry =
                                    zipInputStream.getNextEntry();
                                while (zipEntry != null) {
                                    Utils.execute("HtFileInsert");
                                    fileId2 =
                                            fileIterator1.getCurrentRow().getAttribute("Id").toString();
                                    if (zipEntry.isDirectory() == false) {
                                        File fileName =
                                            fileName = new File(fileId2 + "_" +
                                                                zipEntry.getName());
                                        File fileEx =
                                            new File(dir, fileName.toString());
                                        File filePath =
                                            new File(dirFile, fileName.toString());
                                        if (fileEx.getParentFile().exists() ==
                                            false) {
                                            fileEx.getParentFile().mkdirs();
                                        }
                                        FileOutputStream fileExOut =
                                            new FileOutputStream(fileEx);
                                        byte[] buffer = new byte[1024];
                                        int len = 0;
                                        while ((len =
                                                zipInputStream.read(buffer)) !=
                                               -1) {
                                            fileExOut.write(buffer, 0, len);
                                        }
                                        fileIterator1.getCurrentRow().setAttribute("TenFile",
                                                                                   fileName.toString());
                                        fileIterator1.getCurrentRow().setAttribute("DuongDan",
                                                                                   filePath.toString().replace("\\",
                                                                                                               "/"));
                                        fileIterator1.getCurrentRow().setAttribute("MaUngDung",
                                                                                   Utils.ENUM_MA_UNG_DUNG.TTHC.getMaUngDung());
                                        fileList.add(fileId2.toString());
                                        fileExOut.flush();
                                        fileExOut.close();
                                    }
                                    zipEntry = zipInputStream.getNextEntry();
                                }
                                zipInputStream.close();
                            } else {
                                validated = false;
                                _fileEN2 = null;
                                inputFileEN2.resetValue();
                                inputFileEN2.setValue(null);
                                inputFileEN2.setChanged(false);
                                inputFileEN2.setSubmittedValue(null);
                                inputFileEN2.setValid(false);
                                AdfFacesContext.getCurrentInstance().addPartialTarget(inputFileEN2);
                                Utils.showMessage(Utils.MSG_ERROR,
                                                  "File nén không hợp lệ! Hệ thống chỉ hỗ trợ giải nén file dạng *.zip.");
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else {
                        Utils.execute("HtFileInsert");
                        fileId2 =
                                fileIterator1.getCurrentRow().getAttribute("Id").toString();
                        fileList.add(fileId2.toString());
                        if (Utils.fileUpload(this.getFileEN2(), dir,
                                             fileId2.toString())) {
                            fileIterator1.getCurrentRow().setAttribute("TenFile",
                                                                       fileId2.toString() +
                                                                       "_" +
                                                                       this.getFileEN2().getFilename());
                            fileIterator1.getCurrentRow().setAttribute("DuongDan",
                                                                       dirFilePath.toString().replace("\\",
                                                                                                      "/") +
                                                                       "/" +
                                                                       fileId2.toString() +
                                                                       "_" +
                                                                       this.getFileEN2().getFilename());
                            fileIterator1.getCurrentRow().setAttribute("MaUngDung",
                                                                       Utils.ENUM_MA_UNG_DUNG.TTHC.getMaUngDung());
                        }
                    }
                } else {
                    validated = false;
                    _fileEN2 = null;
                    inputFileEN2.resetValue();
                    inputFileEN2.setValue(null);
                    inputFileEN2.setChanged(false);
                    inputFileEN2.setSubmittedValue(null);
                    inputFileEN2.setValid(false);
                    AdfFacesContext.getCurrentInstance().addPartialTarget(inputFileEN2);
                    Utils.showMessage(Utils.MSG_ERROR,
                                      "Tập tin đính kèm chỉ chấp nhận các định dạng doc, docx, xls, xlsx, pdf, tif, jpg, jpeg, gif, png, bmp.");

                }
            }
            if (fileList.size() > 0) {
                String fileUploadedId = "";
                for (int i = 0; i <= fileList.size() - 1; i++) {
                    fileUploadedId += fileList.get(i) + ",";
                }
                fileUploadedId =
                        fileUploadedId.substring(0, fileUploadedId.lastIndexOf(","));
                thutucIterator.getCurrentRow().setAttribute("FileId",
                                                            fileUploadedId);
            }
        } else {
            if (this.operationType == 1) {
                String fileUploadedId = "";
                if (currentFiles.size() > 0) {
                    for (int i = 0; i < currentFiles.size(); i++) {
                        fileUploadedId += currentFiles.get(i) + ",";
                    }
                    fileUploadedId =
                            fileUploadedId.substring(0, fileUploadedId.lastIndexOf(","));
                }
                thutucIterator.getCurrentRow().setAttribute("FileId",
                                                            fileUploadedId);
            }
        }
        if (tieudeEN.isEmpty() || tieudeEN == "") {
            validated = false;
            Utils.showMessage(Utils.MSG_ERROR,
                              "Tiêu đ�? thủ tục không được để trống.");
        }
        if (tieudeEN.equals(thutucIterator.getCurrentRow().getAttribute("Tieude")) ==
            false) {
            if (Utils.checkExisted(tieudeEN, "Tieude",
                                   "TthcThutucValidate1Iterator", "en")) {
                validated = false;
                Utils.showMessage(Utils.MSG_ERROR,
                                  "Tiêu đ�? bạn vừa nhập đã tồn tại trong hệ thống.");
            }
        }
        if (validated) {
            thutucIterator.getCurrentRow().setAttribute("Tieude", tieudeEN);
            thutucIterator.getCurrentRow().setAttribute("DanhmucId",
                                                        danhmucSelectedValueEN);
            String arrCoquan = "";
            for (int i = 0; i < selectEnValues.size(); i++) {
                arrCoquan += selectEnValues.get(i) + ",";
            }
            arrCoquan = arrCoquan.substring(0, arrCoquan.lastIndexOf(","));
            thutucIterator.getCurrentRow().setAttribute("CoquanId", arrCoquan);
            thutucIterator.getCurrentRow().setAttribute("LinhvucId",
                                                        linhvucSelectedValueEN);
            if (this.operationType == 0) {
                thutucIterator.getCurrentRow().setAttribute("NgonNgu", "en");
                thutucIterator.getCurrentRow().setAttribute("NguoiNhap",
                                                            Utils.getCurrentUser());
                thutucIterator.getCurrentRow().setAttribute("NgayNhap",
                                                            Utils.getCurrentDate());
            }
            Utils.execute("Commit");
            this.operationType = 0;
            hasFile = false;
            currentFiles.clear();
            this.unZipFile = false;
        }
    }

    public void deleteFileVN(ActionEvent actionEvent) {
        DCIteratorBinding fileIterator =
            Utils.getIteratorBinding("HtFileView1Iterator");
        fileIterator.setCurrentRowWithKeyValue(fileDeleted);
        fileIterator.removeCurrentRow();
        for (int i = 0; i < currentFiles.size(); i++) {
            if (currentFiles.contains(fileDeleted)) {
                currentFiles.remove(fileDeleted);
            }
        }
        AdfFacesContext.getCurrentInstance().addPartialTarget(iterVN);
    }

    public void deleteFileEN(ActionEvent actionEvent) {
        DCIteratorBinding fileIterator =
            Utils.getIteratorBinding("HtFileView1Iterator");
        fileIterator.setCurrentRowWithKeyValue(fileDeleted);
        fileIterator.removeCurrentRow();
        for (int i = 0; i < currentFiles.size(); i++) {
            if (currentFiles.contains(fileDeleted)) {
                currentFiles.remove(fileDeleted);
            }
        }
        AdfFacesContext.getCurrentInstance().addPartialTarget(iterEN);
    }

    public void cancelDiaglog(PopupCanceledEvent popupCanceledEvent) {
        if (this.operationType == 0) {
            Utils.execute("Rollback");
        }
        if (this.operationType == 1) {
            this.unZipFile = false;
            hasFile = false;
            currentFiles.clear();
        }
        this.operationType = 0;
    }

    public void deleteVN(DialogEvent dialogEvent) {
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_VN1Iterator");
        String thutucId =
            thutucIterator.getCurrentRow().getAttribute("Id").toString();
        ViewObject vo = thutucIterator.getViewObject();
        vo.setAccessMode(RowSet.SCROLLABLE);
        thutucIterator.setCurrentRowWithKeyValue(thutucId);

        Object cFile = thutucIterator.getCurrentRow().getAttribute("FileId");
        if (cFile != null) {
            String str[] = cFile.toString().split(",");
            if (str.length > 0) {
                for (int i = 0; i < str.length; i++) {
                    currentFiles.add(str[i]);
                }
            }
            DCIteratorBinding fileIterator =
                Utils.getIteratorBinding("HtFileView1Iterator");
            for (int i = 0; i < currentFiles.size(); i++) {
                fileIterator.setCurrentRowWithKeyValue(currentFiles.get(i));
                fileIterator.removeCurrentRow();
            }
        }
        Utils.execute("DeleteVN");
        Utils.execute("Commit");
        hasFile = false;
        operationType = 0;
        currentFiles.clear();
        vo.setAccessMode(RowSet.RANGE_PAGING);
        //Utils.iteratorRefresh("TthcThutucView_VN1Iterator");
    }

    public void deleteEN(DialogEvent dialogEvent) {
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_EN1Iterator");
        String thutucId =
            thutucIterator.getCurrentRow().getAttribute("Id").toString();
        ViewObject vo = thutucIterator.getViewObject();
        vo.setAccessMode(RowSet.SCROLLABLE);
        thutucIterator.setCurrentRowWithKeyValue(thutucId);

        Object cFile = thutucIterator.getCurrentRow().getAttribute("FileId");
        if (cFile != null) {
            String str[] = cFile.toString().split(",");
            if (str.length > 0) {
                for (int i = 0; i < str.length; i++) {
                    currentFiles.add(str[i]);
                }
            }
            DCIteratorBinding fileIterator =
                Utils.getIteratorBinding("HtFileView1Iterator");
            for (int i = 0; i < currentFiles.size(); i++) {
                fileIterator.setCurrentRowWithKeyValue(currentFiles.get(i));
                fileIterator.removeCurrentRow();
            }
        }
        Utils.execute("DeleteEN");
        Utils.execute("Commit");
        hasFile = false;
        currentFiles.clear();
        operationType = 0;
        vo.setAccessMode(RowSet.RANGE_PAGING);
        //Utils.iteratorRefresh("TthcThutucView_EN1Iterator");
    }

    public void searchVN() {
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_VN1Iterator");
        ViewObject vo = thutucIterator.getViewObject();
        ViewCriteria vc = vo.createViewCriteria();
        vc.setName("ThutucViewCriteriaVN");

        ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
        ViewCriteriaItem rowViewCriteriaItem =
            vcRow.ensureCriteriaItem("DanhmucId");
        rowViewCriteriaItem.setOperator(JboCompOper.OPER_EQ);
        rowViewCriteriaItem.setValue(danhmucSelectedValueVN);
        vcRow.setConjunction(ViewCriteriaRow.VC_CONJ_AND);
        ViewCriteriaItem rowViewCriteriaItem1 =
            vcRow.ensureCriteriaItem("CoquanId");
        rowViewCriteriaItem1.setOperator(JboCompOper.OPER_CONTAINS_DELIMITED_ID);
        rowViewCriteriaItem1.setValue(coquanSelectedValueVN);
        vcRow.setConjunction(ViewCriteriaRow.VC_CONJ_AND);
        ViewCriteriaItem rowViewCriteriaItem2 =
            vcRow.ensureCriteriaItem("LinhvucId");
        rowViewCriteriaItem2.setOperator(JboCompOper.OPER_EQ);
        rowViewCriteriaItem2.setValue(linhvucSelectedValueVN);
        vcRow.setConjunction(ViewCriteriaRow.VC_CONJ_AND);
        ViewCriteriaItem rowViewCriteriaItem3 =
            vcRow.ensureCriteriaItem("Tieude");
        rowViewCriteriaItem3.setOperator(JboCompOper.OPER_CONTAINS);
        rowViewCriteriaItem3.setValue(tieudeTimkiemVN);

        vc.addRow(vcRow);
        vo.getViewCriteriaManager().removeApplyViewCriteriaName("ThutucViewCriteriaVN");
        vo.applyViewCriteria(vc);
        vo.executeQuery();
        //        if (vo.getAllRowsInRange().length > 0) {
        //            if (tieudeTimkiemVN!=null) {
        //                for (int i = 0; i < vo.getAllRowsInRange().length; i++) {
        //                    vo.getRowAtRangeIndex(i).setAttribute("Tieude",
        //                                                          vo.getRowAtRangeIndex(i).getAttribute("Tieude").toString().replace(tieudeTimkiemVN,
        //                                                                                                                             "<span style='background:yellow;'>" +
        //                                                                                                                             tieudeTimkiemVN +
        //                                                                                                                             "</span>"));
        //                }
        //            }
        //        }
    }

    public void searchEN() {
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_EN1Iterator");
        ViewObject vo = thutucIterator.getViewObject();
        ViewCriteria vc = vo.createViewCriteria();
        vc.setName("ThutucViewCriteriaEN");

        ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
        ViewCriteriaItem rowViewCriteriaItem =
            vcRow.ensureCriteriaItem("DanhmucId");
        rowViewCriteriaItem.setOperator(JboCompOper.OPER_EQ);
        rowViewCriteriaItem.setValue(danhmucSelectedValueEN);
        vcRow.setConjunction(ViewCriteriaRow.VC_CONJ_AND);
        ViewCriteriaItem rowViewCriteriaItem1 =
            vcRow.ensureCriteriaItem("CoquanId");
        rowViewCriteriaItem1.setOperator(JboCompOper.OPER_CONTAINS_DELIMITED_ID);
        rowViewCriteriaItem1.setValue(coquanSelectedValueEN);
        vcRow.setConjunction(ViewCriteriaRow.VC_CONJ_AND);
        ViewCriteriaItem rowViewCriteriaItem2 =
            vcRow.ensureCriteriaItem("LinhvucId");
        rowViewCriteriaItem2.setOperator(JboCompOper.OPER_EQ);
        rowViewCriteriaItem2.setValue(linhvucSelectedValueEN);
        vcRow.setConjunction(ViewCriteriaRow.VC_CONJ_AND);
        ViewCriteriaItem rowViewCriteriaItem3 =
            vcRow.ensureCriteriaItem("Tieude");
        rowViewCriteriaItem3.setOperator(JboCompOper.OPER_CONTAINS);
        rowViewCriteriaItem3.setValue(tieudeTimkiemEN);

        vc.addRow(vcRow);
        vo.getViewCriteriaManager().removeApplyViewCriteriaName("ThutucViewCriteriaEN");
        vo.applyViewCriteria(vc);
        vo.executeQuery();
    }

    public void setNewPopupVN(RichPopup newPopupVN) {
        this.newPopupVN = newPopupVN;
    }

    public RichPopup getNewPopupVN() {
        return newPopupVN;
    }

    public void setNewPopupEN(RichPopup newPopupEN) {
        this.newPopupEN = newPopupEN;
    }

    public RichPopup getNewPopupEN() {
        return newPopupEN;
    }

    public void setFileVN(UploadedFile _fileVN) {
        this._fileVN = _fileVN;
    }

    public UploadedFile getFileVN() {
        return _fileVN;
    }

    public void setFileEN(UploadedFile _fileEN) {
        this._fileEN = _fileEN;
    }

    public UploadedFile getFileEN() {
        return _fileEN;
    }

    public void setOperationType(int operationType) {
        thutucbean.operationType = operationType;
    }

    public int getOperationType() {
        return operationType;
    }

    public void setUnZipFile(boolean unZipFile) {
        this.unZipFile = unZipFile;
    }

    public boolean getUnZipFile() {
        return unZipFile;
    }

    public void setFileDeleted(String fileDeleted) {
        this.fileDeleted = fileDeleted;
    }

    public String getFileDeleted() {
        return fileDeleted;
    }

    public void setHasFile(boolean hasFile) {
        this.hasFile = hasFile;
    }

    public boolean isHasFile() {
        return hasFile;
    }

    public void setFileExisted(boolean fileExisted) {
        this.fileExisted = fileExisted;
    }

    public boolean isFileExisted() {
        if (operationType == 1 && hasFile == true) {
            fileExisted = true;
        }
        return fileExisted;
    }

    public void setIterVN(UIComponent iterVN) {
        this.iterVN = iterVN;
    }

    public UIComponent getIterVN() {
        return iterVN;
    }

    public void setIterEN(UIComponent iterEN) {
        this.iterEN = iterEN;
    }

    public UIComponent getIterEN() {
        return iterEN;
    }

    public void setCurrentFiles(ArrayList<String> currentFiles) {
        this.currentFiles = currentFiles;
    }

    public ArrayList<String> getCurrentFiles() {
        return currentFiles;
    }

    public void rowSelectedVN(SelectionEvent se) {
        Utils.rowSelected(se, "TthcThutucView_VN1");
    }

    public String goToPageVN() {
        Utils.goToPage(RANGE_SIZE, pageNumberVN, "TthcThutucView_VN1");
        return null;
    }

    public String goLastPageVN() {
        Utils.goLastPage(RANGE_SIZE, "TthcThutucView_VN1");
        return null;
    }

    public boolean isLastEnabledVN() {
        return Utils.isLastEnabled(RANGE_SIZE, "TthcThutucView_VN1");
    }

    public boolean isFirstEnabledVN() {
        return Utils.isFirstEnabled(RANGE_SIZE, "TthcThutucView_VN1");
    }

    private JUCtrlRangeBinding getThutucViewVN() {
        return Utils.getViewObject("TthcThutucView_VN1");
    }

    public void setPageNumberVN(int pageNumberVN) {
        JUCtrlRangeBinding thutucView = this.getThutucViewVN();
        if (pageNumberVN >
            Math.max(1, (thutucView.getIteratorBinding().getEstimatedRowCount() -
                         1) / RANGE_SIZE + 1)) {
            pageNumberVN =
                    (int)Math.max(1, (thutucView.getIteratorBinding().getEstimatedRowCount() -
                                      1) / RANGE_SIZE + 1);
        }
        this.pageNumberVN = pageNumberVN;
    }

    public int getPageNumberVN() {
        return pageNumberVN =
                getThutucViewVN().getIteratorBinding().getNavigatableRowIterator().getRangeStart() /
                RANGE_SIZE + 1;
    }

    public void rowSelectedEN(SelectionEvent se) {
        Utils.rowSelected(se, "TthcThutucView_EN1");
    }

    public String goToPageEN() {
        Utils.goToPage(RANGE_SIZE, pageNumberEN, "TthcThutucView_EN1");
        return null;
    }

    public String goLastPageEN() {
        Utils.goLastPage(RANGE_SIZE, "TthcThutucView_EN1");
        return null;
    }

    public boolean isLastEnabledEN() {
        return Utils.isLastEnabled(RANGE_SIZE, "TthcThutucView_EN1");
    }

    public boolean isFirstEnabledEN() {
        return Utils.isFirstEnabled(RANGE_SIZE, "TthcThutucView_EN1");
    }

    private JUCtrlRangeBinding getThutucViewEN() {
        return Utils.getViewObject("TthcThutucView_EN1");
    }


    public void setPageNumberEN(int pageNumberEN) {
        JUCtrlRangeBinding thutucView = this.getThutucViewEN();
        if (pageNumberEN >
            Math.max(1, (thutucView.getIteratorBinding().getEstimatedRowCount() -
                         1) / RANGE_SIZE + 1)) {
            pageNumberEN =
                    (int)Math.max(1, (thutucView.getIteratorBinding().getEstimatedRowCount() -
                                      1) / RANGE_SIZE + 1);
        }
        this.pageNumberEN = pageNumberEN;
    }

    public int getPageNumberEN() {
        return pageNumberEN =
                getThutucViewEN().getIteratorBinding().getNavigatableRowIterator().getRangeStart() /
                RANGE_SIZE + 1;
    }

    public void danhmucVNValueChanged(ValueChangeEvent valueChangeEvent) {
        danhmucSelectedValueVN = valueChangeEvent.getNewValue().toString();
    }

    public void coquanVNValueChanged(ValueChangeEvent valueChangeEvent) {
        coquanSelectedValueVN = valueChangeEvent.getNewValue().toString();
    }

    public void linhvucVNValueChanged(ValueChangeEvent valueChangeEvent) {
        linhvucSelectedValueVN = valueChangeEvent.getNewValue().toString();
    }

    public void danhmucENValueChanged(ValueChangeEvent valueChangeEvent) {
        danhmucSelectedValueEN = valueChangeEvent.getNewValue().toString();
    }

    public void coquanENValueChanged(ValueChangeEvent valueChangeEvent) {
        coquanSelectedValueEN = valueChangeEvent.getNewValue().toString();
    }

    public void linhvucENValueChanged(ValueChangeEvent valueChangeEvent) {
        linhvucSelectedValueEN = valueChangeEvent.getNewValue().toString();
    }

    public void previewVn() {
        getHtFileObjectVn();
        Utils.showPopup(viewPopupVN);
    }

    public void previewEn() {
        getHtFileObjectEn();
        Utils.showPopup(viewPopupEN);
    }

    public void setViewPopupVN(RichPopup viewPopupVN) {
        this.viewPopupVN = viewPopupVN;
    }

    public RichPopup getViewPopupVN() {
        return viewPopupVN;
    }

    public void getHtFileObjectVn() {
        DCIteratorBinding fileIterator =
            Utils.getIteratorBinding("HtFileView1Iterator");
        ViewObject vo = fileIterator.getViewObject();
        ViewCriteria vc = vo.createViewCriteria();
        ViewCriteriaRow cr = vc.createViewCriteriaRow();
        String varStr = "IN (" + getFiledinhkemVn() + ")";
        cr.setAttribute("Id", varStr);
        vc.addElement(cr);
        vo.getViewCriteriaManager().clearViewCriterias();
        vo.applyViewCriteria(vc);
        vo.setRangeSize(-1);
        vo.executeQuery();
    }

    public void getHtFileObjectEn() {
        DCIteratorBinding fileIterator =
            Utils.getIteratorBinding("HtFileView1Iterator");
        ViewObject vo = fileIterator.getViewObject();
        ViewCriteria vc = vo.createViewCriteria();
        ViewCriteriaRow cr = vc.createViewCriteriaRow();
        String varStr = "IN (" + getFiledinhkemEn() + ")";
        cr.setAttribute("Id", varStr);
        vc.addElement(cr);
        vo.getViewCriteriaManager().clearViewCriterias();
        vo.applyViewCriteria(vc);
        vo.setRangeSize(-1);
        vo.executeQuery();
    }

    public void setViewPopupEN(RichPopup viewPopupEN) {
        this.viewPopupEN = viewPopupEN;
    }

    public RichPopup getViewPopupEN() {
        return viewPopupEN;
    }

    public void setFiledinhkemVn(String filedinhkemVn) {
        this.filedinhkemVn = filedinhkemVn;
    }

    public String getFiledinhkemVn() {
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_VN1Iterator");
        Object td = thutucIterator.getCurrentRow().getAttribute("FileId");
        if (td == null)
            filedinhkemVn = "";
        else
            filedinhkemVn = td.toString();
        return filedinhkemVn;
    }

    public void setFiledinhkemEn(String filedinhkemEn) {
        this.filedinhkemEn = filedinhkemEn;
    }

    public String getFiledinhkemEn() {
        DCIteratorBinding thutucIterator =
            Utils.getIteratorBinding("TthcThutucView_EN1Iterator");
        Object td = thutucIterator.getCurrentRow().getAttribute("FileId");
        if (td == null)
            filedinhkemEn = "";
        else
            filedinhkemEn = td.toString();
        return filedinhkemEn;
    }

    public void setTblVN(RichTable tblVN) {
        this.tblVN = tblVN;
    }

    public RichTable getTblVN() {
        return tblVN;
    }

    public void setTblEN(RichTable tblEN) {
        this.tblEN = tblEN;
    }

    public RichTable getTblEN() {
        return tblEN;
    }

    public void setTieudeVN(String tieudeVN) {
        this.tieudeVN = tieudeVN;
    }

    public String getTieudeVN() {
        if (operationType == 1) {
            DCIteratorBinding thutucIterator =
                Utils.getIteratorBinding("TthcThutucView_VN1Iterator");
            if (thutucIterator.getAllRowsInRange().length > 0) {
                tieudeVN =
                        thutucIterator.getCurrentRow().getAttribute("Tieude").toString();
            }
        }
        return tieudeVN;
    }

    public void setTieudeEN(String tieudeEN) {
        this.tieudeEN = tieudeEN;
    }

    public String getTieudeEN() {
        if (operationType == 1) {
            DCIteratorBinding thutucIterator =
                Utils.getIteratorBinding("TthcThutucView_EN1Iterator");
            if (thutucIterator.getAllRowsInRange().length > 0) {
                tieudeEN =
                        thutucIterator.getCurrentRow().getAttribute("Tieude").toString();
            }
        }
        return tieudeEN;
    }

    public void setTieudeTimkiemVN(String tieudeTimkiemVN) {
        this.tieudeTimkiemVN = tieudeTimkiemVN;
    }

    public String getTieudeTimkiemVN() {
        return tieudeTimkiemVN;
    }

    public void setTieudeTimkiemEN(String tieudeTimkiemEN) {
        this.tieudeTimkiemEN = tieudeTimkiemEN;
    }

    public String getTieudeTimkiemEN() {
        return tieudeTimkiemEN;
    }

    public void setNewPopupDeleteVN(RichPopup newPopupDeleteVN) {
        this.newPopupDeleteVN = newPopupDeleteVN;
    }

    public RichPopup getNewPopupDeleteVN() {
        return newPopupDeleteVN;
    }

    public void setNewPopupDeleteEN(RichPopup newPopupDeleteEN) {
        this.newPopupDeleteEN = newPopupDeleteEN;
    }

    public RichPopup getNewPopupDeleteEN() {
        return newPopupDeleteEN;
    }

    public void openDeletePopupVN(ActionEvent actionEvent) {
        if (Utils.getIteratorBinding("TthcThutucView_VN1Iterator").getCurrentRow() ==
            null) {
            String messageText = "Bạn chưa ch�?n thủ tục nào.";
            Utils.showMessage(Utils.MSG_ERROR, messageText);
        } else {
            Utils.showPopup(newPopupDeleteVN);
        }
    }

    public void openDeletePopupEN(ActionEvent actionEvent) {
        if (Utils.getIteratorBinding("TthcThutucView_EN1Iterator").getCurrentRow() ==
            null) {
            String messageText = "Bạn chưa ch�?n thủ tục nào.";
            Utils.showMessage(Utils.MSG_ERROR, messageText);
        } else {
            Utils.showPopup(newPopupDeleteEN);
        }
    }

    public void setDanhmucSelectedValueVN(String danhmucSelectedValueVN) {
        this.danhmucSelectedValueVN = danhmucSelectedValueVN;
    }

    public String getDanhmucSelectedValueVN() {
        return danhmucSelectedValueVN;
    }

    public void setDanhmucElementsVN(SelectItem[] danhmucElementsVN) {
        this.danhmucElementsVN = danhmucElementsVN;
    }

    public SelectItem[] getDanhmucElementsVN() {
        DCIteratorBinding danhmucIterator =
            Utils.getIteratorBinding("TthcDanhmucView_VN1Iterator");
        int length = danhmucIterator.getAllRowsInRange().length;
        danhmucElementsVN = new SelectItem[length];
        SelectItem item = null;
        for (int i = 0; i < length; i++) {
            Row row = danhmucIterator.getRowAtRangeIndex(i);
            if (row != null) {
                item = new SelectItem();
                item.setValue(row.getAttribute("Id").toString());
                item.setLabel(row.getAttribute("Tieude").toString());
            }
            danhmucElementsVN[i] = item;
        }
        return danhmucElementsVN;
    }

    public void setCoquanSelectedValueVN(String coquanSelectedValueVN) {
        this.coquanSelectedValueVN = coquanSelectedValueVN;
    }

    public String getCoquanSelectedValueVN() {
        return coquanSelectedValueVN;
    }

    public void setCoquanElementsVN(SelectItem[] coquanElementsVN) {
        this.coquanElementsVN = coquanElementsVN;
    }

    public SelectItem[] getCoquanElementsVN() {
        DCIteratorBinding coquanIterator =
            Utils.getIteratorBinding("TthcCoquanView_VN1Iterator");
        int length = coquanIterator.getAllRowsInRange().length;
        coquanElementsVN = new SelectItem[length];
        SelectItem item = null;
        for (int i = 0; i < length; i++) {
            Row row = coquanIterator.getRowAtRangeIndex(i);
            if (row != null) {
                item = new SelectItem();
                item.setValue(row.getAttribute("Id").toString());
                item.setLabel(row.getAttribute("Tieude").toString());
            }
            coquanElementsVN[i] = item;
        }
        return coquanElementsVN;
    }

    public void setLinhvucSelectedValueVN(String linhvucSelectedValueVN) {
        this.linhvucSelectedValueVN = linhvucSelectedValueVN;
    }

    public String getLinhvucSelectedValueVN() {
        return linhvucSelectedValueVN;
    }

    public void setLinhvucElementsVN(SelectItem[] linhvucElementsVN) {
        this.linhvucElementsVN = linhvucElementsVN;
    }

    public SelectItem[] getLinhvucElementsVN() {
        DCIteratorBinding linhvucIterator =
            Utils.getIteratorBinding("TthcLinhvucView_VN1Iterator");
        int length = linhvucIterator.getAllRowsInRange().length;
        linhvucElementsVN = new SelectItem[length];
        SelectItem item = null;
        for (int i = 0; i < length; i++) {
            Row row = linhvucIterator.getRowAtRangeIndex(i);
            if (row != null) {
                item = new SelectItem();
                item.setValue(row.getAttribute("Id").toString());
                item.setLabel(row.getAttribute("Tieude").toString());
            }
            linhvucElementsVN[i] = item;
        }
        return linhvucElementsVN;
    }

    public void setDanhmucSelectedValueEN(String danhmucSelectedValueEN) {
        this.danhmucSelectedValueEN = danhmucSelectedValueEN;
    }

    public String getDanhmucSelectedValueEN() {
        return danhmucSelectedValueEN;
    }

    public void setDanhmucElementsEN(SelectItem[] danhmucElementsEN) {
        this.danhmucElementsEN = danhmucElementsEN;
    }

    public SelectItem[] getDanhmucElementsEN() {
        DCIteratorBinding danhmucIterator =
            Utils.getIteratorBinding("TthcDanhmucView_EN1Iterator");
        int length = danhmucIterator.getAllRowsInRange().length;
        danhmucElementsEN = new SelectItem[length];
        SelectItem item = null;
        for (int i = 0; i < length; i++) {
            Row row = danhmucIterator.getRowAtRangeIndex(i);
            if (row != null) {
                item = new SelectItem();
                item.setValue(row.getAttribute("Id").toString());
                item.setLabel(row.getAttribute("Tieude").toString());
            }
            danhmucElementsEN[i] = item;
        }
        return danhmucElementsEN;
    }

    public void setCoquanSelectedValueEN(String coquanSelectedValueEN) {
        this.coquanSelectedValueEN = coquanSelectedValueEN;
    }

    public String getCoquanSelectedValueEN() {
        return coquanSelectedValueEN;
    }

    public void setCoquanElementsEN(SelectItem[] coquanElementsEN) {
        this.coquanElementsEN = coquanElementsEN;
    }

    public SelectItem[] getCoquanElementsEN() {
        DCIteratorBinding coquanIterator =
            Utils.getIteratorBinding("TthcCoquanView_EN1Iterator");
        int length = coquanIterator.getAllRowsInRange().length;
        coquanElementsEN = new SelectItem[length];
        SelectItem item = null;
        for (int i = 0; i < length; i++) {
            Row row = coquanIterator.getRowAtRangeIndex(i);
            if (row != null) {
                item = new SelectItem();
                item.setValue(row.getAttribute("Id").toString());
                item.setLabel(row.getAttribute("Tieude").toString());
            }
            coquanElementsEN[i] = item;
        }
        return coquanElementsEN;
    }

    public void setLinhvucSelectedValueEN(String linhvucSelectedValueEN) {
        this.linhvucSelectedValueEN = linhvucSelectedValueEN;
    }

    public String getLinhvucSelectedValueEN() {
        return linhvucSelectedValueEN;
    }

    public void setLinhvucElementsEN(SelectItem[] linhvucElementsEN) {
        this.linhvucElementsEN = linhvucElementsEN;
    }

    public SelectItem[] getLinhvucElementsEN() {
        DCIteratorBinding linhvucIterator =
            Utils.getIteratorBinding("TthcLinhvucView_EN1Iterator");
        int length = linhvucIterator.getAllRowsInRange().length;
        linhvucElementsEN = new SelectItem[length];
        SelectItem item = null;
        for (int i = 0; i < length; i++) {
            Row row = linhvucIterator.getRowAtRangeIndex(i);
            if (row != null) {
                item = new SelectItem();
                item.setValue(row.getAttribute("Id").toString());
                item.setLabel(row.getAttribute("Tieude").toString());
            }
            linhvucElementsEN[i] = item;
        }
        return linhvucElementsEN;
    }

    public void setInputFileVN(RichInputFile inputFileVN) {
        this.inputFileVN = inputFileVN;
    }

    public RichInputFile getInputFileVN() {
        return inputFileVN;
    }

    public void setInputFileEN(RichInputFile inputFileEN) {
        this.inputFileEN = inputFileEN;
    }

    public RichInputFile getInputFileEN() {
        return inputFileEN;
    }

    public void setDanhmucSelectChoiceVN(RichSelectOneChoice danhmucSelectChoiceVN) {
        this.danhmucSelectChoiceVN = danhmucSelectChoiceVN;
    }

    public RichSelectOneChoice getDanhmucSelectChoiceVN() {
        return danhmucSelectChoiceVN;
    }

    public void setDanhmucSelectChoiceEN(RichSelectOneChoice danhmucSelectChoiceEN) {
        this.danhmucSelectChoiceEN = danhmucSelectChoiceEN;
    }

    public RichSelectOneChoice getDanhmucSelectChoiceEN() {
        return danhmucSelectChoiceEN;
    }

    public void setCoquanSelectChoiceVN(RichSelectOneChoice coquanSelectChoiceVN) {
        this.coquanSelectChoiceVN = coquanSelectChoiceVN;
    }

    public RichSelectOneChoice getCoquanSelectChoiceVN() {
        return coquanSelectChoiceVN;
    }

    public void setCoquanSelectChoiceEN(RichSelectOneChoice coquanSelectChoiceEN) {
        this.coquanSelectChoiceEN = coquanSelectChoiceEN;
    }

    public RichSelectOneChoice getCoquanSelectChoiceEN() {
        return coquanSelectChoiceEN;
    }

    public void setLinhvucSelectChoiceVN(RichSelectOneChoice linhvucSelectChoiceVN) {
        this.linhvucSelectChoiceVN = linhvucSelectChoiceVN;
    }

    public RichSelectOneChoice getLinhvucSelectChoiceVN() {
        return linhvucSelectChoiceVN;
    }

    public void setLinhvucSelectChoiceEN(RichSelectOneChoice linhvucSelectChoiceEN) {
        this.linhvucSelectChoiceEN = linhvucSelectChoiceEN;
    }

    public RichSelectOneChoice getLinhvucSelectChoiceEN() {
        return linhvucSelectChoiceEN;
    }

    public void setButtonDownload(RichCommandButton buttonDownload) {
        this.buttonDownload = buttonDownload;
    }

    public RichCommandButton getButtonDownload() {
        return buttonDownload;
    }

    public void downloadfile(ActionEvent actionEvent) {
        String fileName =
            (String)actionEvent.getComponent().getAttributes().get("fileName");
        buttonDownload.setText(fileName);
        FacesContext context = FacesContext.getCurrentInstance();
        ExtendedRenderKitService erks =
            Service.getService(context.getRenderKit(),
                               ExtendedRenderKitService.class);
        erks.addScript(context, "customHandler();");
    }

    public void dwdFile(FacesContext facesContext, OutputStream out) {
        File duongdan =
            new File(Utils.ENUM_CAU_HINH_KHOA.FILE_ROOT.getValue("HtCauHinhView1Iterator"),
                     Utils.ENUM_CAU_HINH_KHOA.TTHC_DIR.getValue("HtCauHinhView1Iterator"));
        File file = new File(duongdan + "/" + buttonDownload.getText());
        FileInputStream Fileinput = null;
        byte[] bt;
        try {
            Fileinput = new FileInputStream(file);
            int checkline;
            while ((checkline = Fileinput.available()) > 0) {
                bt = new byte[checkline];
                int rst = Fileinput.read(bt);
                out.write(bt, 0, bt.length);
                if (rst == -1)
                    break;

            }
            out.flush();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setShuttleVN(RichSelectOrderShuttle shuttleVN) {
        this.shuttleVN = shuttleVN;
    }

    public RichSelectOrderShuttle getShuttleVN() {
        return shuttleVN;
    }

    public void setShuttleEN(RichSelectOrderShuttle shuttleEN) {
        this.shuttleEN = shuttleEN;
    }

    public RichSelectOrderShuttle getShuttleEN() {
        return shuttleEN;
    }

    public void setSelectOrderVn(RichSelectOrderShuttle selectOrderVn) {
        this.selectOrderVn = selectOrderVn;
    }

    public RichSelectOrderShuttle getSelectOrderVn() {
        return selectOrderVn;
    }

    public void setSelectOrderEn(RichSelectOrderShuttle selectOrderEn) {
        this.selectOrderEn = selectOrderEn;
    }

    public RichSelectOrderShuttle getSelectOrderEn() {
        return selectOrderEn;
    }

    public void setSelectVnValues(List<String> selectVnValues) {
        this.selectVnValues = selectVnValues;
    }

    public List<String> getSelectVnValues() {
        return selectVnValues;
    }

    public void setSelectEnValues(List<String> selectEnValues) {
        this.selectEnValues = selectEnValues;
    }

    public List<String> getSelectEnValues() {
        return selectEnValues;
    }

    public void getShuttleCoquanVn() {
        BindingContainer bc =
            BindingContext.getCurrent().getCurrentBindingsEntry();
        FacesCtrlHierBinding listBinding =
            (FacesCtrlHierBinding)bc.get("TthcCoquanView_VN1");
        Map<String, SelectItem> mapSelectItems = new HashMap();
        //Lấy các ID từ bảng Chuyên mục
        for (int i = 0; i < listBinding.getRowIterator().getRowCount(); i++) {
            SelectItem si = new SelectItem();
            si.setValue(listBinding.getAttributeFromRow(i, "Id").toString());
            si.setLabel(listBinding.getAttributeFromRow(i,
                                                        "Tieude").toString());
            mapSelectItems.put(listBinding.getAttributeFromRow(i,
                                                               "Id").toString(),
                               si);
        }
        UISelectItems usi = new UISelectItems();
        usi.setValue(mapSelectItems.values());
        selectOrderVn.getChildren().clear();
        selectOrderVn.setValue(null);
        selectOrderVn.getChildren().add(usi);
    }

    public void getShuttleCoquanEn() {
        BindingContainer bc =
            BindingContext.getCurrent().getCurrentBindingsEntry();
        FacesCtrlHierBinding listBinding =
            (FacesCtrlHierBinding)bc.get("TthcCoquanView_EN1");
        Map<String, SelectItem> mapSelectItems = new HashMap();
        //Lấy các ID từ bảng Chuyên mục
        for (int i = 0; i < listBinding.getRowIterator().getRowCount(); i++) {
            SelectItem si = new SelectItem();
            si.setValue(listBinding.getAttributeFromRow(i, "Id").toString());
            si.setLabel(listBinding.getAttributeFromRow(i,
                                                        "Tieude").toString());
            mapSelectItems.put(listBinding.getAttributeFromRow(i,
                                                               "Id").toString(),
                               si);
        }
        UISelectItems usi = new UISelectItems();
        usi.setValue(mapSelectItems.values());
        selectOrderEn.getChildren().clear();
        selectOrderEn.setValue(null);
        selectOrderEn.getChildren().add(usi);
    }

    public void setFileVN2(UploadedFile _fileVN2) {
        this._fileVN2 = _fileVN2;
    }

    public UploadedFile getFileVN2() {
        return _fileVN2;
    }

    public void setFileEN2(UploadedFile _fileEN2) {
        this._fileEN2 = _fileEN2;
    }

    public UploadedFile getFileEN2() {
        return _fileEN2;
    }

    public void setInputFileVN2(RichInputFile inputFileVN2) {
        this.inputFileVN2 = inputFileVN2;
    }

    public RichInputFile getInputFileVN2() {
        return inputFileVN2;
    }

    public void setInputFileEN2(RichInputFile inputFileEN2) {
        this.inputFileEN2 = inputFileEN2;
    }

    public RichInputFile getInputFileEN2() {
        return inputFileEN2;
    }

    public void setUnZipFile2(boolean unZipFile2) {
        this.unZipFile2 = unZipFile2;
    }

    public boolean isUnZipFile2() {
        return unZipFile2;
    }
}
